package io;

import java.io.*;

/*
 在连接中使用PW
 */
public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
        //低级流 负责向文件中写入字节
        FileOutputStream fin = new FileOutputStream("per.txt");
        //转换流 高级流 负责链接字符与字节流  将写出的字符转换为字节
        OutputStreamWriter ot = new OutputStreamWriter(fin,"UTF-8");
        //缓冲流 负责块写文本数据加速
        BufferedWriter bw = new BufferedWriter(ot);
        //pw高级流 按行写出字符串并自动行刷新
        PrintWriter pw = new PrintWriter(bw);
        pw.println("像我这样的人");
        pw.println("消愁");
        System.out.println("写入完毕");
        pw.close();
    }
}
